<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>购物车</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="{$smarty.const.PUBLIC_PATH}css/amazeui.min.css"/>
<link rel="stylesheet" href="{$smarty.const.IMAGES_PATH}style.css"/>
<script src="{$smarty.const.PUBLIC_PATH}js/jquery.min.js"></script>
<script src="{$smarty.const.PUBLIC_PATH}js/amazeui.min.js"></script>
</head>

<body>
<div class="container">
	<!--引入头文件-->
	{include file="../header.html"}
	<script>$('.title-link').text("我的收藏")</script>
	
    <div class="am-cf cart-panel" style="min-height: 700px;">
    	<div class="cart-list-panel">
            <ul class="am-avg-sm-1 cart-panel-ul">
            	{if empty($favgoods)}
    				<div class="cart_foot" style="text-align: center;">你没有收藏任何商品哦┭┮﹏┭┮</div>
    				<a href="{$smarty.const.__MODULE__}/IntegralGoods/cats"><div class="cart_foot" style="text-align: center;">去浏览下吧</div></a>
            	{else if}
            	{foreach $favgoods as $k=>$v}
                <li class="favli{$v.id}">
            	<a href="{$smarty.const.__MODULE__}/IntegralGoods/goodsdetail/id/{$v.id}">
                	<div class="imgpanel"><img src="{$v.main_img}" class="am-img-responsive" /></div>
                	<div class="infopanel">
                    	<h3>{$v.name}</h3>
                    	<p>价格：<span class="red2 bold">{$v.price}</span> 积分  </p>
                        <p>收藏数：{$v.fav_cnt}</p>
                        <p>共被兑换：<span class="red2 bold">{$v.salecount}件</span></p>
                        <p><span class="am-fr"><a data-id="{$v.id}" class="am-badge am-badge-danger am-round deletefav">删除</a></span>库存：<span class="red2 bold">{$v.count}</span> 件</p>
                    </div>
                </a>
                </li>
                {/foreach}
                {/if}
            </ul>
        </div>
    </div>
    <div class="cart_foot" style="display: none;">共选中<span class="red2 bold" id="total_good">{$total}</span>种商品；总价：<span class="red2 bold" id="total_amount">{$price}</span>元；总积分：<span class="red2 bold" id="total_jifen">{$jifen}</span></div>
    <div class="cart-tool" style="display: none;">
    	<a class="am-btn am-btn-sm am-btn-success" href="#">
          <i class="am-icon-chevron-left"></i>
          返回
        </a>
        <a class="am-btn am-btn-sm am-btn-warning" href="#">
          <i class="am-icon-shopping-cart"></i>
          结账
        </a>
    </div>
    
    
    <footer data-am-widget="footer" class="am-footer am-footer-default" data-am-footer="{  }">
        <hr data-am-widget="divider" style="" class="am-divider am-divider-default"/>
      <div class="am-footer-miscs ">
        <p>CopyRight©2014 AllMobilize Inc.</p>
        <p>京ICP备13033158</p>
      </div>
    </footer>
    <!--底部-->
    {include file="../footer.html"}
</div>
<script>
	$('.deletefav').click(function(){
//		var thisgoods=$(this);
//		var id=thisgoods.data('id');
//		$('.favli'+id).hide();
		if(confirm("确定删除该收藏吗？")){
			var thisgoods=$(this);
			var data={
				id:thisgoods.data('id'),
			}
		$.post("{$smarty.const.__CONTROLLER__}/deletefav", data, function(ret){
			console.log(ret);
			if(ret){
				$('.favli'+data.id).hide();
//				alert("收藏了");
			}else{
				alert("删除失败");
//				alert("取消了");
			}
		})
		}
	})
</script>
</body>
</html>
